package com.mystudy.concurrent.designModel.contextModel;

/**
 * todo: 网络查询行为
 *
 * @Author acy
 * @Date 2019/05/29
 */
public class QueryFromHttpAction {
	public void execute() {
		try {
			Thread.sleep(1000l);
			MyContext context = ActionContext.getActionContext().getMyContext();
			String name = context.getName();
			String cardId = getCardId(name);
			context.setCardId(cardId);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	private String getCardId(String name){
		try {
			Thread.sleep(1000l);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		return "231231241"+Thread.currentThread().getId();
	}
}
